<?php 
echo '<?xml version="1.0" encoding="utf-8"?>' . "\n";
?>
<rss version="2.0"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
    xmlns:admin="http://webns.net/mvcb/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:content="http://purl.org/rss/1.0/modules/content/">

    <channel>
		<title><?php echo $this->config->item('blog_name', 'ligature'); ?></title>
		<link><?php echo base_url(); ?></link>
	    <description><?php echo $this->config->item('blog_description', 'ligature'); ?></description>
		<dc:language><?php echo $this->config->item('blog_language', 'ligature'); ?></dc:language>
	    <dc:creator><?php echo $this->config->item('contact_email', 'ligature'); ?></dc:creator>

		<dc:rights>Copyright <?php echo gmdate("Y", time()); ?></dc:rights>
		<admin:generatorAgent rdf:resource="http://www.getligature.com/" />

<?php foreach($posts as $post): ?>

		<item>
<?php if (is_null($post->getTweetId())) : ?>
			<title><?php echo xml_convert($post->getTitle()); ?></title>
			<link><?php echo site_url('post/' . $post->getSlug()); ?></link>
			<guid><?php echo site_url('post/' . $post->getSlug()); ?></guid>
<?php else : ?>
			<title><?php echo xml_convert($post->getContent()); ?></title>
			<link>http://twitter.com/<?php echo $post->getAuthorTwitterScreenName(); ?>/status/<?php echo $post->getTweetId(); ?></link>
			<guid>http://twitter.com/<?php echo $post->getAuthorTwitterScreenName(); ?>/status/<?php echo $post->getTweetId(); ?></guid>
<?php endif; ?>
			<description><![CDATA[
<?php echo $post->getContent(); ?>
			]]></description>
			<pubDate><?php echo date ('r', $post->getDateCreated());?></pubDate>
		</item>
<?php endforeach; ?>
    
	</channel>
</rss>